aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/send/bitcoin/[address]/+page.server.js
blob: 9b29a6da95fc80a477da12cc14e39e61f9dc661b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
import { redirect } from '@sveltejs/kit';
import { auth, post } from '$lib/utils';

export const actions = {
	default: async ({ cookies, request }) => {
		let { address, amount } = Object.fromEntries(await request.formData());
		let { tx } = await post('/bitcoin/fee', { address, amount }, auth(cookies));
		await post('/bitcoin/send', { address, tx }, auth(cookies));
		throw redirect(307, '/sent');
	}
};